Skip to content

Conversation

@pvormste
Copy link

@pvormste pvormste commented Jan 19, 2026

Based on this Community PR: getkin#1102

This pull request modernizes the OpenAPI 3 package documentation and CI workflows. It adds comprehensive support and documentation for OpenAPI 3.1 features, including new schema fields, version detection, and JSON Schema 2020-12 validation options. Additionally, it replaces the previous CI workflows with a new, streamlined GitHub Actions workflow for linting and unit tests, and removes legacy workflows.

OpenAPI 3.1 Support and Documentation Enhancements:

  • Updated .github/docs/openapi3.txt to document support for both OpenAPI 3.0.x and 3.1.x, including new features such as type arrays, JSON Schema 2020-12 keywords, webhooks, SPDX license identifiers, and JSON Schema dialect specification.
  • Added new fields and methods to support OpenAPI 3.1:
    • Added summary to Info, identifier to License, and multiple JSON Schema 2020-12 fields to Schema (e.g., const, examples, prefixItems, etc.). [1] [2] [3]
    • Introduced webhooks and jsonSchemaDialect fields to the root T struct.
    • Documented and enhanced the Types type to support type arrays and added helper methods for type checks.
    • Added helper methods for version detection (IsOpenAPI3_0, IsOpenAPI3_1, Version). [1] [2]
    • Introduced EnableJSONSchema2020 for enabling JSON Schema 2020-12 validation.

CI Workflow Modernization:

  • Added a new GitHub Actions workflow .github/workflows/ci-tests.yml to run linting (via golangci-lint) and unit tests, with improved caching and artifact upload.
  • Removed the old multi-OS build/test workflow .github/workflows/go.yml and the shell script linting workflow .github/workflows/shellcheck.yml, simplifying CI to focus on core Go checks and tests. [1] [2]

mieltn and others added 14 commits January 19, 2026 13:07
The implementation provides complete OpenAPI 3.1 specification compliance while maintaining 100% backward compatibility with OpenAPI 3.0.

Added full JSON Schema 2020-12 support with new fields:

- **`Const`** - Constant value validation
- **`Examples`** - Array of examples (replaces singular `example`)
- **`PrefixItems`** - Tuple validation for arrays
- **`Contains`, `MinContains`, `MaxContains`** - Array containment validation
- **`PatternProperties`** - Pattern-based property matching
- **`DependentSchemas`** - Conditional schema dependencies
- **`PropertyNames`** - Property name validation
- **`UnevaluatedItems`, `UnevaluatedProperties`** - Unevaluated keyword support
- **Type arrays** - Support for `["string", "null"]` notation

- **`Webhooks`** - New field for defining webhook callbacks (OpenAPI 3.1)
- **`JSONSchemaDialect`** - Specifies default JSON Schema dialect
- **Version detection methods**:
  - `IsOpenAPI3_0()` - Returns true for 3.0.x documents
  - `IsOpenAPI3_1()` - Returns true for 3.1.x documents
  - `Version()` - Returns major.minor version string

- **`Identifier`** - SPDX license expression (alternative to URL)

- **`Summary`** - Short summary of the API (OpenAPI 3.1)

New methods for working with type arrays:

- `IncludesNull()` - Checks if null type is included
- `IsMultiple()` - Detects type arrays (OpenAPI 3.1 feature)
- `IsSingle()` - Checks for single type
- `IsEmpty()` - Checks for unspecified types

A new opt-in validator using [santhosh-tekuri/jsonschema/v6](https://github.com/santhosh-tekuri/jsonschema):

- Full JSON Schema Draft 2020-12 compliance
- Automatic OpenAPI → JSON Schema transformation
- Converts OpenAPI 3.0 `nullable` to type arrays
- Handles `exclusiveMinimum`/`exclusiveMaximum` conversion
- Comprehensive error formatting
- Fallback to built-in validator on compilation errors
…d formatting and correcting the version logic
@pvormste pvormste force-pushed the TT-16407/oas-3.1-community-pr branch from 3633de3 to f4b96b0 Compare January 19, 2026 12:09
@pvormste pvormste merged commit ba04a83 into master Jan 20, 2026
2 checks passed
@pvormste pvormste deleted the TT-16407/oas-3.1-community-pr branch January 20, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants